package com.yoyo.ad.bean;



import com.yoyo.ad.main.IKey;
import com.yoyo.ad.utils.TimeUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;

@Entity(// Define indexes spanning multiple columns here.
        indexes = {
                @Index(value = "adId DESC, createTime DESC", unique = true)
        })
public class AdLocalConfig implements IKey {

    @Id
    private Long id;
    private Long adId;
    private int adPositionId;
    private long recentShowTime;
    private String createTime;
    private int showCount;
    private int ipCount;

    public AdLocalConfig(Long adId, int adPositionId) {
        this.adId = adId;
        this.adPositionId = adPositionId;
        this.ipCount = 0;
        createTime = TimeUtils.getDate(System.currentTimeMillis());
    }

    @Generated(hash = 1760207123)
    public AdLocalConfig(Long id, Long adId, int adPositionId, long recentShowTime,
                         String createTime, int showCount, int ipCount) {
        this.id = id;
        this.adId = adId;
        this.adPositionId = adPositionId;
        this.recentShowTime = recentShowTime;
        this.createTime = createTime;
        this.showCount = showCount;
        this.ipCount = ipCount;
    }

    @Generated(hash = 1828427332)
    public AdLocalConfig() {
    }

    @Override
    public String toString() {
        return "AdLocalConfig{" +
                "id=" + id +
                ", adId=" + adId +
                ", adPositionId=" + adPositionId +
                ", recentShowTime=" + recentShowTime +
                ", createTime='" + createTime + '\'' +
                ", showCount=" + showCount +
                ", ipCount=" + ipCount +
                '}';
    }

    @Override
    public String getKey() {
        return String.valueOf(this.adId);
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getAdId() {
        return this.adId;
    }

    public void setAdId(Long adId) {
        this.adId = adId;
    }

    public int getAdPositionId() {
        return this.adPositionId;
    }

    public void setAdPositionId(int adPositionId) {
        this.adPositionId = adPositionId;
    }

    public long getRecentShowTime() {
        return this.recentShowTime;
    }

    public void setRecentShowTime(long recentShowTime) {
        this.recentShowTime = recentShowTime;
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public int getShowCount() {
        return this.showCount;
    }

    public void setShowCount(int showCount) {
        this.showCount = showCount;
    }

    public int getIpCount() {
        return this.ipCount;
    }

    public void setIpCount(int ipCount) {
        this.ipCount = ipCount;
    }
}
